package exec

// GasMapper map instruction name to gas cost
type GasMapper struct {
}

func (g *GasMapper) MapGas(op string) (int64, bool) {
	v, ok := gasCostTable[op]
	return v, ok
}

var gasCostTable = map[string]int64{
	"<invalid>":                  0,
	"alloca":                     100000,
	"atomic.notify":              100000,
	"block":                      0,
	"br":                         2,
	"br_if":                      3,
	"br_on_exn":                  100000,
	"br_table":                   2,
	"br_unless":                  100000,
	"call":                       2,
	"call_host":                  100000,
	"call_indirect":              3,
	"catch":                      100000,
	"catch_all":                  100000,
	"data":                       100000,
	"data.drop":                  100000,
	"drop":                       3,
	"drop_keep":                  100000,
	"elem.drop":                  100000,
	"else":                       2,
	"end":                        0,
	"f32.abs":                    100000,
	"f32.add":                    100000,
	"f32.ceil":                   100000,
	"f32.const":                  0,
	"f32.convert_s/i32":          100000,
	"f32.convert_u/i32":          100000,
	"f32.convert_s/i64":          100000,
	"f32.convert_u/i64":          100000,
	"f32.copysign":               100000,
	"f32.demote/f64":             100000,
	"f32.div":                    100000,
	"f32.eq":                     100000,
	"f32.floor":                  100000,
	"f32.ge":                     100000,
	"f32.gt":                     100000,
	"f32.le":                     100000,
	"f32.load":                   100000,
	"f32.lt":                     100000,
	"f32.max":                    100000,
	"f32.min":                    100000,
	"f32.mul":                    100000,
	"f32.ne":                     100000,
	"f32.nearest":                100000,
	"f32.neg":                    100000,
	"f32.reinterpret/i32":        100000,
	"f32.sqrt":                   100000,
	"f32.store":                  100000,
	"f32.sub":                    100000,
	"f32.trunc":                  100000,
	"f32x4.abs":                  100000,
	"f32x4.add":                  100000,
	"f32x4.convert_i32x4_s":      100000,
	"f32x4.convert_i32x4_u":      100000,
	"f32x4.div":                  100000,
	"f32x4.eq":                   100000,
	"f32x4.extract_lane":         100000,
	"f32x4.ge":                   100000,
	"f32x4.gt":                   100000,
	"f32x4.le":                   100000,
	"f32x4.lt":                   100000,
	"f32x4.max":                  100000,
	"f32x4.min":                  100000,
	"f32x4.mul":                  100000,
	"f32x4.ne":                   100000,
	"f32x4.neg":                  100000,
	"f32x4.replace_lane":         100000,
	"f32x4.splat":                100000,
	"f32x4.sqrt":                 100000,
	"f32x4.sub":                  100000,
	"f64.abs":                    100000,
	"f64.add":                    100000,
	"f64.ceil":                   100000,
	"f64.const":                  0,
	"f64.convert_s/i32":          100000,
	"f64.convert_u/i32":          100000,
	"f64.convert_s/i64":          100000,
	"f64.convert_u/i64":          100000,
	"f64.copysign":               100000,
	"f64.div":                    100000,
	"f64.eq":                     100000,
	"f64.floor":                  100000,
	"f64.ge":                     100000,
	"f64.gt":                     100000,
	"f64.le":                     100000,
	"f64.load":                   100000,
	"f64.lt":                     100000,
	"f64.max":                    100000,
	"f64.min":                    100000,
	"f64.mul":                    100000,
	"f64.ne":                     100000,
	"f64.nearest":                100000,
	"f64.neg":                    100000,
	"f64.promote/f32":            100000,
	"f64.reinterpret/i64":        100000,
	"f64.sqrt":                   100000,
	"f64.store":                  100000,
	"f64.sub":                    100000,
	"f64.trunc":                  100000,
	"f64x2.abs":                  100000,
	"f64x2.add":                  100000,
	"f64x2.convert_i64x2_s":      100000,
	"f64x2.convert_i64x2_u":      100000,
	"f64x2.div":                  100000,
	"f64x2.eq":                   100000,
	"f64x2.extract_lane":         100000,
	"f64x2.ge":                   100000,
	"f64x2.gt":                   100000,
	"f64x2.le":                   100000,
	"f64x2.lt":                   100000,
	"f64x2.max":                  100000,
	"f64x2.min":                  100000,
	"f64x2.mul":                  100000,
	"f64x2.ne":                   100000,
	"f64x2.neg":                  100000,
	"f64x2.replace_lane":         100000,
	"f64x2.splat":                100000,
	"f64x2.sqrt":                 100000,
	"f64x2.sub":                  100000,
	"get_global":                 3,
	"set_global":                 3,
	"i16x8.add":                  100000,
	"i16x8.add_saturate_s":       100000,
	"i16x8.add_saturate_u":       100000,
	"i16x8.all_true":             100000,
	"i16x8.any_true":             100000,
	"i16x8.eq":                   100000,
	"i16x8.extract_lane_s":       100000,
	"i16x8.extract_lane_u":       100000,
	"i16x8.ge_s":                 100000,
	"i16x8.ge_u":                 100000,
	"i16x8.gt_s":                 100000,
	"i16x8.gt_u":                 100000,
	"i16x8.le_s":                 100000,
	"i16x8.le_u":                 100000,
	"i16x8.lt_s":                 100000,
	"i16x8.lt_u":                 100000,
	"i16x8.mul":                  100000,
	"i16x8.ne":                   100000,
	"i16x8.neg":                  100000,
	"i16x8.replace_lane":         100000,
	"i16x8.shl":                  100000,
	"i16x8.shr_s":                100000,
	"i16x8.shr_u":                100000,
	"i16x8.splat":                100000,
	"i16x8.sub":                  100000,
	"i16x8.sub_saturate_s":       100000,
	"i16x8.sub_saturate_u":       100000,
	"i32.add":                    1,
	"i32.and":                    1,
	"i32.atomic.load":            100000,
	"i32.atomic.load16_u":        100000,
	"i32.atomic.load8_u":         100000,
	"i32.atomic.rmw.add":         100000,
	"i32.atomic.rmw.and":         100000,
	"i32.atomic.rmw.cmpxchg":     100000,
	"i32.atomic.rmw.or":          100000,
	"i32.atomic.rmw.sub":         100000,
	"i32.atomic.rmw.xchg":        100000,
	"i32.atomic.rmw.xor":         100000,
	"i32.atomic.rmw16.add_u":     100000,
	"i32.atomic.rmw16.and_u":     100000,
	"i32.atomic.rmw16.cmpxchg_u": 100000,
	"i32.atomic.rmw16.or_u":      100000,
	"i32.atomic.rmw16.sub_u":     100000,
	"i32.atomic.rmw16.xchg_u":    100000,
	"i32.atomic.rmw16.xor_u":     100000,
	"i32.atomic.rmw8.add_u":      100000,
	"i32.atomic.rmw8.and_u":      100000,
	"i32.atomic.rmw8.cmpxchg_u":  100000,
	"i32.atomic.rmw8.or_u":       100000,
	"i32.atomic.rmw8.sub_u":      100000,
	"i32.atomic.rmw8.xchg_u":     100000,
	"i32.atomic.rmw8.xor_u":      100000,
	"i32.atomic.store":           100000,
	"i32.atomic.store16":         100000,
	"i32.atomic.store8":          100000,
	"i32.atomic.wait":            100000,
	"i32.clz":                    105,
	"i32.const":                  0,
	"i32.ctz":                    105,
	"i32.div_s":                  80,
	"i32.div_u":                  80,
	"i32.eq":                     1,
	"i32.eqz":                    1,
	"i32.extend16_s":             100000,
	"i32.extend8_s":              100000,
	"i32.ge_s":                   1,
	"i32.ge_u":                   1,
	"i32.gt_s":                   1,
	"i32.gt_u":                   1,
	"i32.le_s":                   1,
	"i32.le_u":                   1,
	"i32.load":                   3,
	"i32.load16_s":               3,
	"i32.load16_u":               3,
	"i32.load8_s":                3,
	"i32.load8_u":                3,
	"i32.lt_s":                   1,
	"i32.lt_u":                   1,
	"i32.mul":                    3,
	"i32.ne":                     1,
	"i32.or":                     1,
	"i32.popcnt":                 3,
	"i32.reinterpret/f32":        3,
	"i32.rem_s":                  80,
	"i32.rem_u":                  80,
	"i32.rotl":                   2,
	"i32.rotr":                   2,
	"i32.shl":                    2,
	"i32.shr_s":                  2,
	"i32.shr_u":                  2,
	"i32.store":                  3,
	"i32.store16":                3,
	"i32.store8":                 3,
	"i32.sub":                    1,
	"i32.trunc_s/f32":            3,
	"i32.trunc_u/f32":            3,
	"i32.trunc_s/f64":            3,
	"i32.trunc_u/f64":            3,
	"i32.trunc_sat_f32_s":        3,
	"i32.trunc_sat_f32_u":        3,
	"i32.trunc_sat_f64_s":        3,
	"i32.trunc_sat_f64_u":        3,
	"i32.wrap/i64":               3,
	"i32.xor":                    1,
	"i32x4.add":                  100000,
	"i32x4.all_true":             100000,
	"i32x4.any_true":             100000,
	"i32x4.eq":                   100000,
	"i32x4.extract_lane":         100000,
	"i32x4.ge_s":                 100000,
	"i32x4.ge_u":                 100000,
	"i32x4.gt_s":                 100000,
	"i32x4.gt_u":                 100000,
	"i32x4.le_s":                 100000,
	"i32x4.le_u":                 100000,
	"i32x4.lt_s":                 100000,
	"i32x4.lt_u":                 100000,
	"i32x4.mul":                  100000,
	"i32x4.ne":                   100000,
	"i32x4.neg":                  100000,
	"i32x4.replace_lane":         100000,
	"i32x4.shl":                  100000,
	"i32x4.shr_s":                100000,
	"i32x4.shr_u":                100000,
	"i32x4.splat":                100000,
	"i32x4.sub":                  100000,
	"i32x4.trunc_sat_f32x4_s":    100000,
	"i32x4.trunc_sat_f32x4_u":    100000,
	"i64.add":                    1,
	"i64.and":                    1,
	"i64.atomic.load":            100000,
	"i64.atomic.load16_u":        100000,
	"i64.atomic.load32_u":        100000,
	"i64.atomic.load8_u":         100000,
	"i64.atomic.rmw.add":         100000,
	"i64.atomic.rmw.and":         100000,
	"i64.atomic.rmw.cmpxchg":     100000,
	"i64.atomic.rmw.or":          100000,
	"i64.atomic.rmw.sub":         100000,
	"i64.atomic.rmw.xchg":        100000,
	"i64.atomic.rmw.xor":         100000,
	"i64.atomic.rmw16.add_u":     100000,
	"i64.atomic.rmw16.and_u":     100000,
	"i64.atomic.rmw16.cmpxchg_u": 100000,
	"i64.atomic.rmw16.or_u":      100000,
	"i64.atomic.rmw16.sub_u":     100000,
	"i64.atomic.rmw16.xchg_u":    100000,
	"i64.atomic.rmw16.xor_u":     100000,
	"i64.atomic.rmw32.add_u":     100000,
	"i64.atomic.rmw32.and_u":     100000,
	"i64.atomic.rmw32.cmpxchg_u": 100000,
	"i64.atomic.rmw32.or_u":      100000,
	"i64.atomic.rmw32.sub_u":     100000,
	"i64.atomic.rmw32.xchg_u":    100000,
	"i64.atomic.rmw32.xor_u":     100000,
	"i64.atomic.rmw8.add_u":      100000,
	"i64.atomic.rmw8.and_u":      100000,
	"i64.atomic.rmw8.cmpxchg_u":  100000,
	"i64.atomic.rmw8.or_u":       100000,
	"i64.atomic.rmw8.sub_u":      100000,
	"i64.atomic.rmw8.xchg_u":     100000,
	"i64.atomic.rmw8.xor_u":      100000,
	"i64.atomic.store":           100000,
	"i64.atomic.store16":         100000,
	"i64.atomic.store32":         100000,
	"i64.atomic.store8":          100000,
	"i64.atomic.wait":            100000,
	"i64.clz":                    105,
	"i64.const":                  0,
	"i64.ctz":                    105,
	"i64.div_s":                  80,
	"i64.div_u":                  80,
	"i64.eq":                     1,
	"i64.eqz":                    1,
	"i64.extend16_s":             3,
	"i64.extend32_s":             3,
	"i64.extend8_s":              3,
	"i64.extend_s/i32":           3,
	"i64.extend_u/i32":           3,
	"i64.ge_s":                   1,
	"i64.ge_u":                   1,
	"i64.gt_s":                   1,
	"i64.gt_u":                   1,
	"i64.le_s":                   1,
	"i64.le_u":                   1,
	"i64.load":                   3,
	"i64.load16_s":               3,
	"i64.load16_u":               3,
	"i64.load32_s":               3,
	"i64.load32_u":               3,
	"i64.load8_s":                3,
	"i64.load8_u":                3,
	"i64.lt_s":                   1,
	"i64.lt_u":                   1,
	"i64.mul":                    3,
	"i64.ne":                     1,
	"i64.or":                     1,
	"i64.popcnt":                 1,
	"i64.reinterpret/f64":        3,
	"i64.rem_s":                  80,
	"i64.rem_u":                  80,
	"i64.rotl":                   2,
	"i64.rotr":                   2,
	"i64.shl":                    2,
	"i64.shr_s":                  2,
	"i64.shr_u":                  2,
	"i64.store":                  3,
	"i64.store16":                3,
	"i64.store32":                3,
	"i64.store8":                 3,
	"i64.sub":                    1,
	"i64.trunc_s/f32":            3,
	"i64.trunc_u/f32":            3,
	"i64.trunc_s/f64":            3,
	"i64.trunc_u/f64":            3,
	"i64.trunc_sat_f32_s":        3,
	"i64.trunc_sat_f32_u":        3,
	"i64.trunc_sat_f64_s":        3,
	"i64.trunc_sat_f64_u":        3,
	"i64.xor":                    1,
	"i64x2.add":                  100000,
	"i64x2.all_true":             100000,
	"i64x2.any_true":             100000,
	"i64x2.extract_lane":         100000,
	"i64x2.neg":                  100000,
	"i64x2.replace_lane":         100000,
	"i64x2.shl":                  100000,
	"i64x2.shr_s":                100000,
	"i64x2.shr_u":                100000,
	"i64x2.splat":                100000,
	"i64x2.sub":                  100000,
	"i64x2.trunc_sat_f64x2_s":    100000,
	"i64x2.trunc_sat_f64x2_u":    100000,
	"i8x16.add":                  100000,
	"i8x16.add_saturate_s":       100000,
	"i8x16.add_saturate_u":       100000,
	"i8x16.all_true":             100000,
	"i8x16.any_true":             100000,
	"i8x16.eq":                   100000,
	"i8x16.extract_lane_s":       100000,
	"i8x16.extract_lane_u":       100000,
	"i8x16.ge_s":                 100000,
	"i8x16.ge_u":                 100000,
	"i8x16.gt_s":                 100000,
	"i8x16.gt_u":                 100000,
	"i8x16.le_s":                 100000,
	"i8x16.le_u":                 100000,
	"i8x16.lt_s":                 100000,
	"i8x16.lt_u":                 100000,
	"i8x16.mul":                  100000,
	"i8x16.ne":                   100000,
	"i8x16.neg":                  100000,
	"i8x16.replace_lane":         100000,
	"i8x16.shl":                  100000,
	"i8x16.shr_s":                100000,
	"i8x16.shr_u":                100000,
	"i8x16.splat":                100000,
	"i8x16.sub":                  100000,
	"i8x16.sub_saturate_s":       100000,
	"i8x16.sub_saturate_u":       100000,
	"if":                         0,
	"get_local":                  3,
	"set_local":                  3,
	"tee_local":                  3,
	"loop":                       0,
	"memory.copy":                100000,
	"memory.fill":                100000,
	"memory.grow":                100000,
	"memory.init":                100000,
	"memory.size":                10000000,
	"nop":                        0,
	"ref.func":                   100000,
	"ref.is_null":                100000,
	"ref.null":                   100000,
	"rethrow":                    100000,
	"return":                     2,
	"return_call":                100000,
	"return_call_indirect":       100000,
	"select":                     3,
	"table.copy":                 100000,
	"table.fill":                 100000,
	"table.get":                  100000,
	"table.grow":                 100000,
	"table.init":                 100000,
	"table.set":                  100000,
	"table.size":                 100000,
	"throw":                      100000,
	"try":                        100000,
	"unreachable":                0,
	"v128.and":                   100000,
	"v128.bitselect":             100000,
	"v128.const":                 0,
	"v128.load":                  100000,
	"v128.not":                   100000,
	"v128.or":                    100000,
	"v128.store":                 100000,
	"v128.xor":                   100000,
	"v8x16.shuffle":              100000,
	"v8x16.shuffle1":             100000,
	"v8x16.shuffle2_imm":         100000,
}
